#pragma once

#include "EncapsulatedClassifier.h"

#include "Port.h"

namespace uml {

void EncapsulatedClassifier::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    StructuredClassifier::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(ownedPorts_, "ownedPorts", json, errorList);
}

void EncapsulatedClassifier::toJson(QJsonObject& json) {
    StructuredClassifier::toJson(json);
    JsonSerializable::toJsonArray(ownedPorts_, "ownedPorts", json);
}

/// <summary>
/// ownedPorts getter
/// The Ports owned by the EncapsulatedClassifier.
/// </summary>
vector<shared_ptr<Port>>& EncapsulatedClassifier::ownedPorts() {
    return ownedPorts_;
}

} // namespace uml
